package com.thysdy.flowable.controller;

import com.thysdy.flowable.entity.ProcessDefinition;
import com.thysdy.flowable.exception.MyException;
import com.thysdy.flowable.service.ProcessModelService;
import com.thysdy.flowable.vo.ReturnVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
public class ProcessModelController {
    @Autowired
    ProcessModelService processModelService;

    /**
     * 获取流程定义列表
     *
     * @return
     */
    @GetMapping("/getProcessDefinitionList")
    public ReturnVo getProcessDefinitionList() {
        List<ProcessDefinition> list = null;
        try {
            list = processModelService.getProcessDefinitionList();
            return ReturnVo.success(list);
        } catch (MyException e) {
            return ReturnVo.exception(e);
        }
    }
}
